﻿@inherits Blazorise.FileEdit
<Control Role="ControlRole.File">
    <Label Type="LabelType.File" For="@ElementId">
        <input @ref="@ElementRef" id="@ElementId" type="file" class="@ClassNames" style="@StyleNames" disabled="@Disabled" readonly="@ReadOnly" multiple="@Multiple" webkitdirectory="@Directory" accept="@Filter" tabindex="@TabIndex" placeholder="@Placeholder" @onkeydown="@OnKeyDownHandler" @onkeypress="@OnKeyPressHandler" @onkeyup="@OnKeyUpHandler" @onblur="@OnBlurHandler" @onfocus="@OnFocusHandler" @onfocusin="@OnFocusInHandler" @onfocusout="@OnFocusOutHandler" @attributes="@Attributes" />
        @ChildContent
        <span class="file-cta">
            <span class="file-label">
                @BrowseButtonString
            </span>
        </span>
        <span class="file-name">
            @if ( !HasSelectedFileNames && Placeholder != null )
            {
                <Span TextColor="TextColor.Muted">
                    @Placeholder
                </Span>
            }
            else
            {
                @SelectedFilenamesString
            }
        </span>
    </Label>
</Control>
@Feedback
@code{
    string SelectedFilenamesString => string.Join( ", ", SelectedFileNames );

    bool HasSelectedFileNames => SelectedFileNames.Any();
}